home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 008 / 68kgraph.arc / DEMO.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-12-13  |  3.4 KB  |  97 lines

  1. ******************************************************************
  2. * COPYRIGHT (C) 1986 by Donald Krantz and James Stanley
  3. * - Note: This is a real, live, actual, registered copyright,
  4. *   and should be treated as such. This source code is from
  5. *   the book "68000 Assembly Language", Krantz and Stanley,
  6. *   Addison-Wesley Publishing Company, Reading, MA, 1986.
  7. *   Permission granted by the authors for non-commercial use
  8. *   in programs released to the public domain, as long as this
  9. *   copyright notice remains attached and visible.
  10. *
  11. * Graphics test
  12. #bit.h
  13.  
  14.     xref    g_pix,g_clear,g_vector,g_mode,g_circle,g_fill
  15.     xref    creep,dump,arrow,snarl
  16.     xdef    image
  17.     
  18.     move.w    #jam_m,d0
  19.     bsr    g_mode
  20.     bsr    g_clear        * clear up screen
  21. ******* Draw distorted crosshatch *******************************
  22.     move.w    #0,d0        * set initial moving X
  23.     move.w    #vert-1,d3    * set initial moving Y
  24. lpx:
  25.     clr.w    d1        * set stationary Y
  26.     clr.w    d2        * set stationary X
  27.     bsr    g_vector    * draw line
  28.     move.w    #vert-1,d1    * go across image for stationary
  29.     move.w    #hor_b-1,d2    * X and Y
  30.     bsr    g_vector    * draw reflected line
  31.     add.w    #8,d0        * move the moving X
  32.     sub.w    #5,d3        * move the moving Y
  33.     cmp.w    #hor_b,d0    * check for  limit
  34.     blt    lpx        * loop if we aren't at limit
  35. ******* circle test - concentric circles ************************
  36.     move.w    #hor_b/2,d0    * center the circles in the image
  37.     move.w    #vert/2,d1    
  38.     move.w    #5,d2        * start with a tiny radius
  39.     move.w    #1,d3        * this will be incrementer
  40. lpc:
  41.     bsr    g_circle    * draw the circle 
  42.     add.w    d3,d2        * double the radius
  43.     addq.w    #1,d3        * increment the incrementer
  44.     cmp    #75,d2        * check that we don't get too big
  45.     blt    lpc        * if not, make more circles
  46. ******* fill in between two of the circles **********************
  47.     move.w    #65,d1        * pick Y to start creep
  48.     bsr    creep        * do creep 
  49. ******* mode check - set mode to complement for next tests ******
  50.     move.w    #comp_m,d0
  51.     bsr    g_mode
  52. ******* fill test ***********************************************
  53.     move.w    #0,d0        * make a vertical bar down the
  54.     move.w    #(vert/2-20),d1    * center
  55.     move.w    #hor_b-1,d2
  56.     move.w    #(vert/2+20),d3
  57.     bsr    g_fill
  58.     move.w    #(hor_b/2-5),d0    * make a horizontal bar across
  59.     move.w    #0,d1        * the center
  60.     move.w    #(hor_b/2+5),d2
  61.     move.w    #vert-1,d3
  62.     bsr    g_fill
  63. ******* Arrow icon test    *****************************************
  64.     move.w    #jam_m,d0    * test first in jam mode
  65.     bsr    g_mode
  66.     move.w    #20,d0        * put way over on left
  67.     move.w    #(vert/2+15),d1    * and half on filled area
  68.     bsr    arrow        * put arrow
  69.     move.w    #comp_m,d0    * next test complement mode
  70.     bsr    g_mode        * set comp code
  71.     move.w    #35,d0        * put next arrow just right
  72.     bsr    arrow        * put arrow
  73.     move.w    #set_m,d0    * next try set mode
  74.     bsr    g_mode        * set set mode
  75.     move.w    #50,d0        * put next arrow just right
  76.     bsr    arrow        * put arrow
  77.     move.w    #clr_m,d0    * last, try clear mode
  78.     bsr    g_mode        * set clear mode
  79.     move.w    #65,d0        * put last arrow to the right
  80.     bsr    arrow        * put arrow
  81. ******* Snarl icon test *****************************************
  82.     move.w    #jam_m,d0    * reset to jam mode
  83.     bsr    g_mode        * set mode
  84.     move.w    #278,d0        * put way over on right
  85.     move.w    #10,d1        * and down a little from top
  86.     bsr    snarl        * put snarl icon
  87. ******* now we dump our picture to the printer ******************
  88.     bsr    dump
  89.     rts
  90. *****************************************************************
  91.     bss
  92. image:
  93.     ds.b    vert*hor_w    * This is the global image memory
  94.  
  95.     end
  96.